#include <iostream>
#include <string>
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"

int file_size(char* filename)
{
	FILE *fp=fopen(filename,"r");
	if(!fp) return -1;
	fseek(fp,0L,SEEK_END);
	int size=ftell(fp);
	fclose(fp);

	return size;
}

int main()
{
	clang::FileSystemOptions fso;
	fso.WorkingDir = "./";
	clang::FileManager fm(fso);
	auto fe_ptr = fm.getVirtualFile("hello.c", file_size("hello.c"), 0);
	std::cout << fe_ptr << std::endl;

	if(fe_ptr != nullptr){
		std::cout << fe_ptr->getName().str() << std::endl;
		std::cout << fe_ptr->getSize() << std::endl;
		std::cout << fe_ptr->isValid() << std::endl;
		std::cout << fe_ptr->getDir()->getName().str() << std::endl;
		std::cout << fm.getCanonicalName(fe_ptr->getDir()).str() << std::endl;
	}

	return 0;
}
